#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
    int n, m = 0;
    scanf("%d %d", &n, &m);
    int arr[2000];
    int i, j, temp = 0;
    for (i = 0; i < n; i++)
    {
        scanf("%d ", &arr[i]);
    }
    for (j = i; j < m + n; j++)
    {
        scanf("%d ", &arr[j]);
    }
    for (i = 0; i < m + n; i++)
    {
        for (j = 0; j < m + n; j++)
        {
            if (arr[j] >= arr[j + 1])
            {
                temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }
    for (i = 0; i < m + n; i++)
    {
        printf("%d ", arr[i]);
    }
    return 0;
}